package com.cts.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cts.constant.AboutConstant;
import com.cts.entity.About;
import com.cts.model.vo.Result;
import com.cts.service.AboutService;
import com.cts.mapper.AboutMapper;
import com.mysql.cj.util.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
* @author tongshengchen
* @description 针对表【about】的数据库操作Service实现
* @createDate 2023-02-06 18:30:39
*/
@Service
public class AboutServiceImpl extends ServiceImpl<AboutMapper, About>
    implements AboutService{

    @Autowired
    AboutMapper aboutMapper;

    @Override
    public List<About> getSiteSetting() {
        return aboutMapper.getList();
    }

    @Override
    public Result saveAbout(Map<String, String> aboutMap) {
        aboutMap.forEach((key,value)->
            saveAboutByNameEn(key, value)
        );
        return Result.ok("保存成功");
    }

    @Override
    public void saveAboutByNameEn(String nameEn, String value) {
        aboutMapper.saveAboutByNameEn(nameEn,value);
    }


}




